﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom.Compiler;

namespace RobotBattle2.Scripting {
	public sealed class BinaryExpression : Expression {
		public BinaryExpression() { }
		public BinaryExpression(Expression left, Expression right, BinaryOperator @operator) {
			this.Left = left;
			this.Right = right;
			this.Operator = @operator;
		}

		public BinaryOperator Operator { get; set; }
		public Expression Left { get; set; }
		public Expression Right { get; set; }

		public override void Dump(IndentedTextWriter writer) {
			writer.Write(Operator);
			writer.Write('(');
			Left.Dump(writer);
			writer.Write(',');
			Right.Dump(writer);
			writer.Write(')');
		}

		public override ExpressionType Type { get { return ExpressionType.Binary; } }
	}
}
